package com.qcu.config;

import com.qcu.intercept.LoginIntercept;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.CorsRegistry;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

import javax.annotation.Resource;

/**
 * @Name: MyComputer
 * @ClassName WebConfig
 * @Description:
 * @date 2025/2/7 10:34
 */
@Configuration
public class WebConfig implements WebMvcConfigurer {
    @Resource
    private LoginIntercept loginIntercept;
    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(loginIntercept).excludePathPatterns("/user/user/login","/chat/**","/user/user/restPwd","/user/user/register","/user/user/getEmailCode","/staff/risk/export","/static/**","/user/pay/notify");
    }

    @Override
    public void addResourceHandlers(ResourceHandlerRegistry registry) {
        registry.addResourceHandler("/static/**")
                .addResourceLocations("classpath:/static/");
    }
}
